﻿using System;
using System.Reflection;
using System.Resources;
using System.Threading;

namespace MyAMS
{
    internal static class Resource
    {
        private static readonly string BaseName = "MyAMS.Resources";

        private static ResourceManager reader;

        public static ResourceManager Reader
        {
            get
            {
                if (reader == null)
                {
                    reader = new ResourceManager(BaseName, Assembly.GetExecutingAssembly());
                }
                return reader;
            }
        }

        public static string Get(string name)
        {
            return Reader.GetString(name, Thread.CurrentThread.CurrentCulture);
        }

        public static string Get(string name, params object[] args)
        {
            string fmt = Get(name);
            return String.Format(fmt, args);
        }
    }
}
